package com.sinochem.sales.service.service.impl;

import com.sinochem.sales.common.api.vo.AppVersionsVO;
import com.sinochem.sales.service.service.IAppVersionsService;
import org.apache.log4j.Logger;
import org.sagacity.sqltoy.dao.SqlToyLazyDao;
import org.sagacity.sqltoy.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author xuan😴🐶🐱🐽🌺  <a href="zhangshixuanj@163.com">联系作者</a>
 * @version Revision:v1.0,Date: 2018/5/16 19:26
 * @project parent
 * @description app
 * @Modification Date: 2018/5/16 19:26  {填写修改说明}
 */
@Service
public class AppVersionsServiceImpl implements IAppVersionsService {
    /**
     * 日志
     */
    private final static Logger logger = Logger.getLogger(AppVersionsServiceImpl.class);

    @Autowired
    private SqlToyLazyDao sqlToyLazyDao;

    @Override
    public AppVersionsVO findByType(String type) {
        try {
            return (AppVersionsVO) sqlToyLazyDao.loadBySql("find_by_type", new String[]{"type"},
                    new Object[]{type}, AppVersionsVO.class);
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("查询版本信息失败!:{}", e);
            throw new BaseException("查询版本信息失败!");
        }
    }

}
